﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using HandyControl.Tools.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsCountdownShutdownSoftware.ViewModels.Dialogs
{
    public partial class TextDialogViewModel : ObservableObject, IDialogResultable<int>
    {
        /// <summary>
        /// 文本信息
        /// </summary>
        [ObservableProperty]
        public string _textInfo;

        /// <summary>
        /// 是否确定 0 不确定 1 确定
        /// </summary>
        public int ConfirmResult = 0;



        /// <summary>
        /// 结果值
        /// </summary>
        public int Result 
        { 
            get {
                return ConfirmResult;
            } 
          
            set {
                ConfirmResult = value;
            } 
        }

   


        /// <summary>
        /// 关闭程序
        /// </summary>
        public Action CloseAction { get; set; }


        [RelayCommand]
        private void Confirm()
        {
            // 表示确定
            ConfirmResult = 1;
            CloseAction?.Invoke();
        }
    }

}
